﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Web;
using WmsService.Security;

namespace WmsService.BusinessLogic
{
    public abstract class LogicBase
    {
        public string ContextUserID
        {
            get { return AuthenticationFactory.GetAuthentication().GetCurrentUserID(GetContextToken()); }
        }

        public string ContextUserName
        {
            get { return AuthenticationFactory.GetAuthentication().GetCurrentUserName(GetContextToken()); }
        }

        public string GetContextToken()
        {
            var token = OperationContext.Current.IncomingMessageHeaders.GetHeader<String>("token", "ns");
            return token;
        }
    }
}